﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="editPwd.aspx.cs" Buffer="false" Inherits="Page_editPwd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../css/Site.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../css/theme.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/icon.css"/>
    <script src="../../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../js/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/form.js" type="text/javascript"></script>
    <script src="../../js/Json.js" type="text/javascript"></script>
     
</head>
<body style=" overflow:hidden; background-color:White">
<form runat="server">
    <div id="pnlPwd"  style="overflow:auto ">
        <div class="ftitle">密码信息</div>  
        <div class="fitem">  
            <label>用户名:</label>  
            <span id="UserName"></span>  
            <input id="UserKey" type="hidden" value="0" /> 
        </div>  
        <div class="fitem">  
            <label>原密码:</label>  
            <input  id="Password" class="easyui-validatebox input-required" type="password"  style="width:150px" />  

        </div> 
        <div class="fitem">  
            <label>新密码:</label>  
            <input  id="PasswordNew" class="easyui-validatebox input-required"  type="password" style="width:150px"/>  
        </div> 
        <div class="fitem">  
            <label>确认密码:</label>  
            <input id="PasswordNew2" class="easyui-validatebox input-required"  type="password" style="width:150px" />  
        </div>                  
    </div>

    <div id="dlg-buttons" class="dialog-button" style="position:absolute;left:0px; height:30px;  padding-top:2px; text-align:center">  
         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="dlgJs.doSave()">保存</a>  
         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:top.main.closeDlg()">取消</a>  
     </div> 
   
 </form>
          

   <script type="text/javascript" >

       dlgJs = {

           currData: null,

           getDate: function(text, format) {
               if ($.trim(text) == "") return null;
               else return (new Date(text.replace("-", "/").replace("-", "/"))).format(format);
           },
           //初始化数据 
           initField: function(fName, value) {
               if (value) $(fName).val(value);

           },
           initData: function() {
               var data = currUser;
               this.initField("#UserKey", data.USER_KEY);
               $("#UserName").html(data.USER_NAME);
               this.initField("#Password", data.PASSWORD);

           },

           validate: function() {
               var valMeg = BasicJs.valField("PasswordNew", 50, "新密码", true);
               if (valMeg != "") {
                   BasicJs.showMessage(valMeg, false);
                   return false;
               }
               valMeg = BasicJs.valField("PasswordNew2", 50, "确认密码", true);
               if (valMeg != "") {
                   BasicJs.showMessage(valMeg, false);
                   return false;
               }
               if ($.trim($("#PasswordNew").val()) != $.trim($("#PasswordNew2").val())) valMeg = "新密码和确认密码不一致！"
               if (valMeg != "") {
                   BasicJs.showMessage(valMeg, false);
                   return false;
               }
               return true;

           },
           //***********employee save************
           doSave: function() {
               if (this.validate() == false) return;
               var parm = { UserKey: $.trim($("#UserKey").val()),
                   PasswordNew: $.trim($("#PasswordNew").val()),
                   Password: $.trim($("#Password").val())
               };
               $.post("../../ashx/hEditPwd.ashx?action=editPwd", { data: JSON.stringify(parm) }, function(result) {
                   if (result.Success) {
                       BasicJs.showMessage("修改成功！", true);
                       top.main.closeDlg(true);
                   }
                   else {
                       //error
                       BasicJs.showMessage(result.Message, 0);
                   }
                   //close dialog
               }, "json"
             );

           }

       }

       $(function () {
           var wHeight = $(window).height();
           var wWidth = $(window).width();
           $("#pnlPwd").width(wWidth).height(wHeight - 30);
           $("#dlg-buttons").css({ top: wHeight - 30, width: wWidth });

           //初始化焦点
           dlgJs.initData();
           setTimeout('$("#PasswordNew").focus()', 100);

       })

    </script>
    <script src="../../js/Common.js" type="text/javascript"></script>

</body>
</html>
